file(GLOB_RECURSE PLATFORM_SOURCES CONFIGURE_DEPENDS
        "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
)

add_library(platform SHARED ${PLATFORM_SOURCES})

target_include_directories(platform
        PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>  # 给外部模块用
        PRIVATE
        ${CMAKE_CURRENT_SOURCE_DIR}/src                        # 模块内部用
)

target_link_libraries(platform PRIVATE fs_compat)

if(WIN32)
    target_compile_definitions(platform PRIVATE PLATFORM_WINDOWS)
elseif(APPLE)
    target_compile_definitions(platform PRIVATE PLATFORM_MACOS)
    set_target_properties(platform PROPERTIES
        MACOSX_RPATH ON
        INSTALL_NAME_DIR "@rpath"
    )
elseif(UNIX)
    target_compile_definitions(platform PRIVATE PLATFORM_LINUX)
endif()
